package com.qztc.news_end_customer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.Map;

import static com.qztc.news_end_customer.config.GlobalConfig.SEVICE_URL;

@RestController
@RequestMapping("/thenews/verify")
public class VerifyCodeControllerByRestTemplate {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/generateVerifyCode")
    public String generateVerifyCode() {
        return restTemplate.getForObject(SEVICE_URL+"verify/generateVerifyCode", String.class);
    }


    @PostMapping("/checkVerifyCode")
    public String checkVerifyCode(@RequestBody Map<String, String> verifyParams) {
        return restTemplate.postForObject(SEVICE_URL + "verify/checkVerifyCode", verifyParams, String.class);
    }
}
